package com.functest.util

/**
 * @author: DavydovMD
 * Date: 18.06.13
 * Time: 15:19
 */
enum TriState {
    YES, NO, UNDEFINED

    Boolean toBoolean() {
        if (this == YES) return true
        if (this == NO) return false
        null
    }

    static TriState fromBoolean(Boolean b) {
        if (b == null) return null
        if (b) return YES
        NO
    }

    static TriState fromAny(Object any) {
        fromBoolean(any?.asBoolean())
    }
}